import Vue from "vue";
import Vuex from "vuex";
Vue.use(Vuex);

const store = new Vuex.Store({
  //存储token
  state: {
    token: "",
    receiver: [], //保存地址信息
  },
  //   修改token状态
  mutations: {
    saveToken: (state, payload) => {
      state.token = payload;
    },
    // 地址信息存储
    saveReceiver: (state, payload) => {
      state.receiver = payload; //添加收货人信息
    },
    // //地址持久化时直接赋值给vuex
    // localStorageReceiver: (state, payload) => {
    //   state.receiver = payload;
    // },
  },
});
export default store;
